//MAP STORE
//This scan stores a map as a 2D array
// and publishes it as well as an occupancy grid

class Scan_node;
#include <vector>
#include <deque>
#include "nav_msgs/OccupancyGrid.h"
#include "ros/ros.h"
#include "geometry_msgs/Pose.h"
#include "geometry_msgs/TransformStamped.h"
#include "map.hpp"

class Mapstore {
	//Mapstore uses the resolution value from scan_node
	private:
	
	ros::Publisher mapPub;
	ros::NodeHandle * nodeHandle;
	
	public:
	
	Mapstore();
	Mapstore(ros::NodeHandle& nh);
	void publishMap();
	void generateMap(std::vector<Scan_node> nodes);

    std::vector<Scan_node>* nodeVecPtr;
	
	Map mapData;
	nav_msgs::OccupancyGrid map;
	geometry_msgs::Pose origin;

    void tfChangedCallback(Scan_node * node, geometry_msgs::TransformStamped oldTf, geometry_msgs::TransformStamped newTf);
    void dataChangedCallback(Scan_node * node);
	
};
